//
//  NSDateFormatter+QDShare.m
//  QDMetroClient
//
//  Created by YueWen on 2019/2/18.
//  Copyright © 2019 YueWen. All rights reserved.
//

#import "NSDateFormatter+QDShare.h"

static NSDateFormatter *cachedDateFormatter = nil;

@implementation NSDateFormatter (QDShare)

+ (NSDateFormatter *)cachedDataFormatterWithString:(NSString *)formatter {
    
    if (!cachedDateFormatter) {
        cachedDateFormatter = [[NSDateFormatter alloc] init];
        [cachedDateFormatter setLocale:[NSLocale currentLocale]];
    }
    if (formatter) {
        [cachedDateFormatter setDateFormat:formatter];
    }else {
        [cachedDateFormatter setDateFormat: @"YYYY-MM-dd HH:mm:ss"];
    }
    return cachedDateFormatter;
}

@end
